<!-- meta tags  -->
<%@page import="org.springframework.web.util.WebUtils"%>
<%@page import="net.groupme.gui.constants.VIEW_VOCABULARY"%>
<%@page import="net.groupme.utils.sql.UserQueryUtility"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="net.groupme.user.UserManager"%>
<%@page import="net.groupme.model.ObjectFactory"%>
<%@page import="net.groupme.logging.utils.UserTrackerUtility"%>
<%@page import="org.springframework.web.util.CookieGenerator"%>
<%@page import="java.util.Enumeration"%>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="description" content="GroupMe! - Semantic Web meets Web 2.0 - Ontologies meet Folksonomies"/>
<meta name="keywords" content="Semantic Web, Web 2.0, Tagging, Web 2.0, Ontology, Folksonomy, "/>
<meta name="author" content="GroupMe.org"/>
<meta name="DC.Publisher" content="GroupMe.org"/>
<meta name="DC.Date" content="2007-06-01T012:00+01:00"/>
<meta name="DC.Language" content="en"/>

<!-- style reference -->
<link rel="stylesheet" href="<%= request.getContextPath() %>/style/styleme.css" type="text/css" media="screen" />
<link rel="icon" href="<%= request.getContextPath() %>/images/favicon.ico" type="image/x-icon"/>

<!-- Google Analystics -->

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript"><!--
	_uacct = "UA-2313610-1";
	urchinTracker();
	//-->
</script>


<% //check for permanent login cookies:
	UserManager userManager = null;
	try{
		userManager = (UserManager) WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext()).getBean(VIEW_VOCABULARY.USER_MANGER, UserManager.class);	
	}catch(Exception e){
		//hm...
	}
	if(userManager != null && !userManager.isLoggedIn()){
		Cookie usernameCookie = WebUtils.getCookie(request, VIEW_VOCABULARY.COOKIE_PERMANENT_LOGIN_USER_ID);
		Cookie credentialCookie = WebUtils.getCookie(request, VIEW_VOCABULARY.COOKIE_PERMANENT_LOGIN_CREDENTIAL);
		if(credentialCookie != null && usernameCookie != null){
			String userId = usernameCookie.getValue();
			if(UserQueryUtility.isUserLoggedIn(userId, credentialCookie.getValue())){
				userManager.setUser(ObjectFactory.getUser(new Integer(userId)));
			}
		}
	}
	
	//User Tracking:
	String clientCode = null;
	Cookie trackerCookie = WebUtils.getCookie(request, VIEW_VOCABULARY.COOKIE_FOR_USER_TRACKING);
	
	if(trackerCookie == null){
		clientCode = UserTrackerUtility.generateNewClientCode(request);
		CookieGenerator cg = new CookieGenerator();
		cg.setCookieName(VIEW_VOCABULARY.COOKIE_FOR_USER_TRACKING);
		cg.setCookieMaxAge(VIEW_VOCABULARY.COOKIE_PERMANENT_LOGIN_LIFETIME);
		cg.addCookie(response, clientCode);
	}else{
		clientCode = trackerCookie.getValue();
	}
%>

<%!
/*Small Function to check for redundant commas within a tag-keyword*/
							
public String deleteRedundantCommas(String keyword){
	String tempKeyword = "";
								
	if(keyword.startsWith(",")){
		tempKeyword = keyword.substring(1);
	}
	else {
		tempKeyword = keyword;
	}
								
	if(tempKeyword.endsWith(",")){
		return tempKeyword.substring(0, keyword.length() - 1);
	}else{
		return tempKeyword;
	}
}

%>